const express = require('express')
const router = express.Router()
const {getList,getCount} = require('../controller/plan')



router.get('/tabs',async (req,res,next)=>{
    const num = req.query.num
    const page = req.query.page
    try{
        const count = await getCount(num)
        const data = await getList(num,page)
        console.log(Math.ceil(count[0].count/15));
        res.json({
            count:Math.ceil(count[0].count/15),
            data
        })
        return
    }catch(err){
        console.log(err);
    }
})

module.exports = router